<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>

<link
	href="css/bootstrap.min.css"
	rel="stylesheet">
</head>
<body>
	<div align="center">
		<h1>
			<font color="ccff33"> 欢迎使用 </font>
		</h1>
	</div>

		<div class="form-group">
			<label for="exampleInputEmail1">用户名</label>
			 <input type="text"
				class="form-control" id="username" placeholder="username">
		</div>
		<div class="form-group">
			<label for="exampleInputPassword1">Password</label> <input
				type="password" class="form-control" id="password"
				placeholder="password">
		</div>

		<div align="center">
			<button  class="btn btn-success btn-block"
				onclick="login()">登陆</button>
		</div>
	<script src="js/jquery.min.js"></script>
	<script
		src="js/bootstrap.min.js"></script>

	<script type="text/javascript">
		function login() {
		<!--alert(1)-->	
			var username = $("#username").val();
			var password = $("#password").val();
			
			if (username == "") {
				alert("用户名不能为空");
				return;
			}
			
			if(password == ""){
				alert("密码不能为空");
				return ;
			}
			
			$.ajax({
				async: false,
				type:"POST",
				url: "http://localhost:8080/login",
				dataType:"text",
				data: {
					"username":username,
					"password":password,
					
				},
				success:function(msg){
					alert(msg);
					window.location.href = "http://localhost:8080/message"
					return;
				},
				error: function() {
					alert("登陆失败");
					return;
				},
			})
		}
	</script>
</body>
</html>